import {
  IsNotEmpty,
  IsOptional,
  IsArray,
  IsEnum,
  Matches,
} from 'class-validator';
import { RecordWay, Unit, SetsType } from 'src/types/motion';

// 通用字段
export default class RecordBaseDto {
  @IsOptional()
  @Matches(/^\d{4}-\d{2}-\d{2}$/, {
    message: '日期格式必须为 YYYY-MM-DD',
  })
  date?: string;

  @IsOptional()
  @IsEnum(RecordWay)
  recordWay: RecordWay;

  @IsOptional()
  @IsEnum(SetsType)
  setsType: SetsType;

  @IsOptional()
  @IsEnum(Unit)
  unit: Unit;

  @IsOptional()
  @IsNotEmpty()
  @IsArray()
  sets?: [number, number][];

  
  @IsOptional()
  takeTime?: number;
}
